package com.woniu.utils;


import com.woniu.inlet.web.fo.CouponFo;
import org.springframework.util.StringUtils;

import java.text.SimpleDateFormat;
import java.util.Date;

public class AppUtils {

    /**
     * 获取本地时间的字符串格式
     *
     * @return
     */
    public static String getNowTimeStr() {
        SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String currentTime = sd.format(new Date());
        return currentTime;
    }

    /**
     * 判断优惠券前端对象是否有空值
     *
     * @param couponFo
     * @return
     */
    public static boolean isNullCouponFo(CouponFo couponFo) {
        if (StringUtils.isEmpty(couponFo.getConditions())
                || StringUtils.isEmpty(couponFo.getName())
                || StringUtils.isEmpty(couponFo.getCreateTime())
                || StringUtils.isEmpty(couponFo.getPrivilege())
                || StringUtils.isEmpty(couponFo.getValidity()))
            return true;
        else
            return false;
    }


}
